package com.aspose.cells;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

class zgx implements ICellsDataTable {
   String[] a;
   Collection b;
   private HashMap c;
   private Iterator d;
   private Object e;
   private Method[] f;

   zgx(Collection var1, Method[] var2) {
      this.b = var1;
      Method[] var3 = new Method[var2.length];
      int var4 = 0;

      int var5;
      for(var5 = 0; var5 < var2.length; ++var5) {
         Method var6 = var2[var5];
         if (Modifier.isPublic(var6.getModifiers()) && var6.getName().startsWith("get") && var6.getParameterTypes().length < 1 && var6.getReturnType() != Void.TYPE && !var6.getName().equals("getClass")) {
            var3[var4] = var2[var5];
            ++var4;
         }
      }

      this.f = new Method[var4];
      System.arraycopy(var3, 0, this.f, 0, var4);
      var3 = null;
      this.a = new String[var4];
      this.c = new HashMap(var4);

      for(var5 = 0; var5 < this.f.length; ++var5) {
         this.a[var5] = this.f[var5].getName().substring(3);
         this.c.put(this.a[var5], this.f[var5]);
      }

      this.beforeFirst();
   }

   public String[] getColumns() {
      return this.a;
   }

   public int getCount() {
      return this.b.size();
   }

   public void beforeFirst() {
      this.e = null;
      this.d = this.b.iterator();
   }

   public Object get(int index) {
      try {
         return this.f[index].invoke(this.e, (Object[])null);
      } catch (Exception var3) {
         return null;
      }
   }

   public Object get(String columnName) {
      try {
         return ((Method)this.c.get(columnName)).invoke(this.e, (Object[])null);
      } catch (Exception var3) {
         return null;
      }
   }

   public boolean next() {
      if (this.d == null) {
         return false;
      } else if (this.d.hasNext()) {
         this.e = this.d.next();
         return true;
      } else {
         return false;
      }
   }
}
